#include "capture.h"

int main ( int argc , char **argv)
{
	int cont = 0;
	char newFile[20];
	parseArgAndDupFiles(argc,argv,DUP_IN | DUP_OUT, NULL, NULL);
	while (1)
	{
		sleep ( CAPTURE_DELAI );

		sprintf(newFile, "vid%04d.cap", cont );
		logMessage(stderr,"Will send file (%s) to server\n",newFile);
		if(sendOperation(stdin,stdout,OP_ADD,newFile)){
			logMessage(stderr, "File sent to server: %s\n", newFile );
		}else{
			logMessage(stderr, "Error, file could not be sent to server: %s\n", newFile );
		}
		fflush(stdout);
		cont++;
	}

	exit(EXIT_SUCCESS);
}
